<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr=[5,52,3,6,4,78,9,1,5];
        for(var j=0;j<arr.length-1;j++){
            var minindexOf=j;
        for(var i=1+j;i<arr.length;i++){
            if(arr[minindexOf]>arr[i]){
                var store=arr[i];
                arr[i]=arr[minindexOf];
                arr[minindexOf]=store;
            }
        }
        var res=arr;
        console.log(res);
        }
       
    </script>
</body>
</html>